<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <title>分类管理 - 默笙后台管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta content="这不仅仅是一个后台管理系统，它基于BT4，超强的自适应，简洁，高效，大方" />
    <meta content="Mosheng" name="author" />


    <!-- App favicon -->
    <link rel="shortcut icon" href="{$Think.const.ADMIN_URL}/assets/images/favicon.ico">

    <!-- third party css -->
    <link href="{$Think.const.ADMIN_URL}/css/vendor/sweetalert2.min.css" rel="stylesheet" type="text/css" />
    <link href="{$Think.const.ADMIN_URL}/css/vendor/dataTables.bootstrap4.css" rel="stylesheet" type="text/css" />
    <link href="{$Think.const.ADMIN_URL}/css/vendor/responsive.bootstrap4.css" rel="stylesheet" type="text/css" />
    <link href="{$Think.const.ADMIN_URL}/css/vendor/buttons.bootstrap4.css" rel="stylesheet" type="text/css" />
    <link href="{$Think.const.ADMIN_URL}/css/vendor/select.bootstrap4.css" rel="stylesheet" type="text/css" />
    <!-- third party css end -->

    <!-- App css -->
    <link href="{$Think.const.ADMIN_URL}/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="{$Think.const.ADMIN_URL}/css/icons.min.css" rel="stylesheet" type="text/css" />
    <link href="{$Think.const.ADMIN_URL}/css/app.min.css" rel="stylesheet" type="text/css" />

</head>

<body>

    <!-- 公共头部开始-->
    <include file="Common:header" />
    <!-- 公共头部结束-->
    <div class="wrapper">
        <div class="container-fluid">

            <!-- start page title -->
            <div class="row">
                <div class="col-12">
                    <div class="page-title-box">
                        <div class="page-title-right">
                            <ol class="breadcrumb m-0">
                                <li class="breadcrumb-item">
                                    <a href="#">默笙</a>
                                </li>
                                <li class="breadcrumb-item">
                                    <a href="#">分类</a>
                                </li>
                                <li class="breadcrumb-item active">分类管理</li>
                            </ol>
                        </div>
                        <h4 class="page-title">分类管理</h4>
                    </div>
                </div>
            </div>
            <!-- end page title -->
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="header-title">分类管理</h4>
                            <p class="text-muted font-13 mb-4">
                                你可以再次预览以及编辑您的分类
                            </p>

                            <table id="key-datatable" class="table dt-responsive nowrap">
                                <thead>
                                    <tr>
                                        <th>id</th>
                                        <th>分类名称</th>
                                        <th>创建时间</th>
                                        <th>操作</th>

                                    </tr>
                                </thead>


                                <tbody>
                                    <volist name="list" id="vo">
                                        <tr>
                                            <td>#{$vo.id}</td>
                                            <td>{$vo.cname}</td>
                                            <td>{$vo.create_time|date='Y/m/d H:i',###}</td>
                                            <td>
                                                <a class="" href="{:U('admin.php/class/update',array('cid'=>$vo[id]))}">
                                                    <i class="mdi mdi-pencil mr-1 text-muted"></i>编辑</a>
                                                <eq name="at.is_all" value="0">
                                                <a class="" onClick="ty_del(this,'{$vo.id}')" href="javascript:;">
                                                    <i class="mdi mdi-delete mr-1 text-muted"></i>删除</a>
                                                </eq>
                                            </td>
                                        </tr>
                                    </volist>
                                </tbody>
                            </table>

                        </div>
                        <!-- end card body-->
                    </div>
                    <!-- end card -->
                </div>
                <!-- end col-->
            </div>
            <!-- end row-->


        </div>
        <!-- end container -->
    </div>
    <!-- end wrapper -->


    <!-- 公共底部开始-->
    <include file="Common:footer" />
    <!-- 公共底部结束-->


    <!-- App js -->
    <script src="{$Think.const.ADMIN_URL}/js/vendor.min.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/app.min.js"></script>

    <!-- third party js -->
    <script src="{$Think.const.ADMIN_URL}/js/vendor/jquery.dataTables.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/vendor/dataTables.bootstrap4.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/vendor/dataTables.responsive.min.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/vendor/responsive.bootstrap4.min.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/vendor/dataTables.buttons.min.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/vendor/buttons.bootstrap4.min.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/vendor/buttons.html5.min.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/vendor/buttons.flash.min.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/vendor/buttons.print.min.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/vendor/dataTables.keyTable.min.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/vendor/dataTables.select.min.js"></script>
    <!-- third party js ends -->

    <!-- demo app -->
    <script src="{$Think.const.ADMIN_URL}/layer/layer.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/pages/datatables.init.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/vendor/sweetalert2.min.js"></script>
    <script src="{$Think.const.ADMIN_URL}/js/pages/sweet-alerts.init.js"></script>
    <!-- end demo js-->
    <script type="text/javascript">

        function ty_del(obj, id) {
            var id = id;
            layer.confirm('确认要删除吗？', function (index) {

                $.ajax({
                    type: 'POST',
                    url: '{:U('admin.php/class/classdel')}',
                    dataType: 'json',
                    data: { id: id },
                    success: function (data) {
                        console.log(data);
                        if (data.status == '1') {
                            layer.msg(data.info);//layer.msg('不开心。。', {icon: 5});
                            window.location.reload();
                        } else {
                            layer.msg(data.info);
                        }
                    },
                    error: function (data) {
                        layer.msg('删除失败!');
                    },
                });
            });
        }
    </script>
</body>

</html>